def main():
    input1 = list(map(int, input().split()))
    num_people = len(input1)
    total_pass = sum(input1)

    ans = [0] * num_people
    curr_num = 1
    curr_index = 0
    while total_pass > 0:
        if curr_num % 7 == 0 or str(curr_num).find('7') != -1:
            total_pass -= 1
            ans[curr_index] += 1
        curr_num += 1
        curr_index = (curr_index + 1) % num_people

    output = ' '.join(map(str, ans))
    print(output)

if __name__ == "__main__":
    main()

